package com.作业.Day7;

public class Homework1 {
    public static void main(String[] args) {
        /**
         * 使用多态实现喂养宠物的功能
         */
        Pet dog = new Dog();
        dog.feed();
        System.out.println(dog.health);


    }
}
abstract class  Pet{
    int health;
    int kiss;
 abstract void feed();
    /**
     * 飞盘
     */
    abstract void play();
}
class Dog extends Pet {
    @Override
    void feed() {
        health+=4;
    }

    @Override
    void play() {
        health-=10;
        kiss+=5;
    }

}
class Penguin extends Pet{

    @Override
    void feed() {
        health+=5;
    }


    @Override
    void play() {
        kiss+=5;
        health-=10;
    }
}